package com.sita.linboard.person;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.hyphenate.chat.EMClient;
import com.sita.linboard.R;
import com.sita.linboard.base.ActivityCollector;
import com.sita.linboard.base.BaseActivity;
import com.sita.linboard.base.BaseApplication;
import com.sita.linboard.login.DriverLoginActivity;
import com.sita.linboard.login.ForgetPassActivity;
import com.sita.linboard.utils.SpUtils;

/**
 * Created by Jason on 2016/9/12.
 */
public class SettingActivity extends BaseActivity implements View.OnClickListener{
    private RelativeLayout change,aboutlayout,feedbacklayout;
    private TextView logoutTx,headTitle;
    private LinearLayout back;
    private static int REQUESTCODE = 1;
    @Override
    protected void initData() {

    }

    @Override
    protected void initView(Bundle savedInstanceState) {
        ActivityCollector.addActivity(this);
            change = bindView(R.id.change_pass);
        change.setOnClickListener(this);
        aboutlayout = bindView(R.id.about);
        aboutlayout.setOnClickListener(this);
        logoutTx = bindView(R.id.logout);
        logoutTx.setOnClickListener(this);
        back = bindView(R.id.img_back);
        back.setOnClickListener(this);
        back.setVisibility(View.VISIBLE);
        headTitle = bindView(R.id.head_title);
        headTitle.setText("设置");
        headTitle.setVisibility(View.VISIBLE);
        feedbacklayout = bindView(R.id.feedback);
        feedbacklayout.setOnClickListener(this);
    }

    @Override
    protected int getId() {
        return R.layout.activity_setting;
    }
    public static void SettingIntent(Context context){
        Intent intent = new Intent(context,SettingActivity.class);
        context.startActivity(intent);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ActivityCollector.removeActivity(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.img_back:
                finish();
                break;
            case R.id.logout:
                SpUtils.putBoolean("isLogin",false, BaseApplication.getContext ());
                ActivityCollector.finishAll();
                DriverLoginActivity.DriverLoginIntent(this);
                EMClient.getInstance().logout(true);
                break;
            case R.id.change_pass:
              ForgetPassActivity.ForgetPassIntent(this,2);
                break;
            case R.id.about:
                AboutActivity.AboutIntent(this);
                break;
            case R.id.feedback:
              FeedBackActivity.FeedBackIntent(this);
                break;
        }
    }
}
